package io.renren.sf.controller;

import io.renren.common.utils.R;
import io.renren.sf.entity.BookRoleEntity;
import io.renren.sf.service.BookRightService;
import io.renren.sf.service.BookRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 
 *
 * @author tongxiaowu
 * @email 15755337992@163.com
 * @date 2021-08-07 14:31:51
 */
@RestController
@RequestMapping("sf/bookright")
public class BookRightController {
    @Autowired
    private BookRightService bookRightService;

    @Autowired
    private BookRoleService bookRoleService;

    @GetMapping("/getRoleRightsById/{id}")
    public R getRoleRightsById(@PathVariable("id") Long id){
        List<Long> bookIds = bookRightService.getRoleRightsById(id);
        List<Long> stiffBookIds = bookRightService.getRoleStiffRightsById(id);
        List<Long> bookExpandIds = bookRightService.getRoleBookExpandRightsById(id);
        List<Long> stiffBookExpandIds = bookRightService.getRoleStiffBookExpandRightsById(id);
        BookRoleEntity bookRole = bookRoleService.getById(id);
        return R.ok().put("bookIds", bookIds).put("stiffBookIds", stiffBookIds).put("bookExpandIds", bookExpandIds).put("stiffBookExpandIds", stiffBookExpandIds).put("bookRole", bookRole);
    }

}
